/**
 * 测试
 */
class Test {
    private tp: string = ''
    private result: unknown;
    private isNot: boolean = false
    // 测试类型
    type(type: string) {
        this.tp = type;
        return this;
    }

    /**
     * 算出的结果
     * @param result 
     */
    expect(result: unknown) {
        this.result = result
        return this;
    }

    /**
     * 期待的结果
     * @param expectRes 
     */
    toBe(expectRes: unknown) {
        if ((this.isNot && this.result === expectRes) || (!this.isNot && this.result !== expectRes)) {
            console.error(`${this.tp} 测试不通过`)
        }
        return this;
    }

    /**
     * 否定结果
     */
    not() {
        this.isNot = true;
        return this
    }

}

export default Test;

